Using a homemade mixture of OxiClean, dish soap, spray window cleaner with ammonia and rubbing alcohol this guy from Sweet Project Cars makes an amazing job of cleaning the filthiest carpets you can imagine. He’s working on the inside of a vehicle here, but this would work on any carpet.
What you need for this project is listed here.